public class E9 {


        private static final int TIMES = 100000;
        public static void main(String[] args) {
            testString();
            testStringBuffer();
            testStringBuilder();

        }
        public static void testString() {
            long starTime = System.currentTimeMillis();
            String str = "";
            for (int i = 0; i < TIMES; i++) {
                str +="test";
            }
            Long endTime = System.currentTimeMillis();
            System.out.println("String test usedtime:"+(endTime-starTime));
        }
        public static void testStringBuffer() {
            long starTime = System.currentTimeMillis();
            StringBuffer str = new StringBuffer();
            for (int i = 0; i < TIMES; i++) {
                str.append("test");
            }
            Long endTime = System.currentTimeMillis();
            System.out.println("StringBuffer test usedtime:"+(endTime-starTime));
        }
        public static void testStringBuilder() {
            long starTime = System.currentTimeMillis();
            StringBuilder str = new StringBuilder();
            for (int i = 0; i < TIMES; i++) {
                str.append("test");
            }
            Long endTime = System.currentTimeMillis();
            System.out.println("StringBuilder test usedtime:"+(endTime-starTime));
        }
    }

